import Vue from 'vue'
import App from './App'
import store from '@/store';
import { debuggerModule } from 'uni_modules/imengyu-IMDebuggerWindow/common/debuggerExtern.js'


import * as filters from '@/common/filters.js';

// const errorHandler = (err, vm, info) => { 
//   if(debuggerModule) debuggerModule.addVueError(err, vm, info);
// }

// Vue.config.errorHandler = errorHandler; 

// 注入全局过滤器
Object.keys(filters).forEach(key => {
	Vue.filter(key, filters[key])
})

// 引入uview
import uView from '@/uni_modules/uview-ui';
Vue.use(uView);

// 全局引入vuex
import vuexStore from '@/store/$u.mixin.js'
Vue.mixin(vuexStore);

// 全局mixin
import '@/common/mixins.js'

// 引入扩展方法
import '@/common/extend.js';

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
	store,
    ...App
})

// http拦截器，将此部分放在new Vue()和app.$mount()之间，才能App.vue中正常使用
import httpInterceptor from '@/apis/http.interceptor.js'
Vue.use(httpInterceptor, app)

// http接口API集中管理引入部分
// import httpApi from '@/apis/http.api.js'
// Vue.use(httpApi, app)

import tools from '@/common/tools.js';
Vue.use(tools, app)


app.$mount(); //为了兼容小程序及app端必须这样写才有效果
